**# Information of the datasets #
*Five sources of data were used in the current analysis:
*1. Qualitative child-direct assessment conducted only at endline. We were unable to collect baseline child-direct assessment data due to the COVID-19 pandemic (see coding frame)
*2. Quantitative child-direct assessment conducted only at endline. 
*3. Baseline caregiver-report survey (see kobo)
*4. Endline caregiver-report survey (see kobo)
*5. Teacher survey that spanned across the study (see kobo)

*We will introduce our strategies to clean, merge and impute these datasets in the current do file. 

*For information on the analyses that we conducted to answer our research questions, please check the do file name main_analyses



**# 1. Qualitative child-direct assessment #
*Information of the datasets:
*- The qualitative child-direct assessment was coded by Arabic-speaking researchers following a coding frame rooted in ground-theory approach (see qualitative coding frame)
*- All these qualitative information were stored in the software Dedoose, followed by extracting to xlsx

import excel vocab_strategies.xlsx, firstrow clear
keep hhid_cg_id_d Code111Anger Code112Caring Code113Fear Code114Frustration Code115Nervousness Code116HopeDetermination Code117Jealousy Code118Loneliness Code119Sadness Code1110Happiness Code311Nothingnoreaction Code312Avoidant Code313Acceptance Code321Hitting Code322Yelling Code323Stealing Code324Ignoressafetyins Code325AggressiveOther Code331Singing Code332Dancing Code333Askforhelp Code334DeterminedBehavior Code335Findinganalternati Code336Playingcontinueto Code337RestingTakingabr Code338Sharing Code339Expressingkindword Code411Nothingnoreaction Code412Avoidant Code413Acceptance Code414ReverseEmotionalRe Code421Hitting Code422Yelling Code423Stealing Code424Ignoressafetyins Code425AggressiveOther Code431Singing Code432Dancing Code433Askforhelp Code434DeterminedBehavior Code435Findinganalternati Code436Playingcontinueto Code437RestingTakingabr Code438Sharing Code439Expressingkindword /// /// Code111 to Code1110: these are emotional vocabulary in table 2 outcome group C; Code 311 to Code 339: these are emotion regulation strategies when asked to choose for characters, and Code 411 to Code 439 are emotion regulation strategies when asked to choose for children themselves. These are in table 2 outcome group D. We later differentaited breathing from take a break. This will be found in later codes.
foreach i in Code111Anger Code112Caring Code113Fear Code114Frustration Code115Nervousness Code116HopeDetermination Code117Jealousy Code118Loneliness Code119Sadness Code1110Happiness Code311Nothingnoreaction Code312Avoidant Code313Acceptance Code321Hitting Code322Yelling Code323Stealing Code324Ignoressafetyins Code325AggressiveOther Code331Singing Code332Dancing Code333Askforhelp Code334DeterminedBehavior Code335Findinganalternati Code336Playingcontinueto Code337RestingTakingabr Code338Sharing Code339Expressingkindword Code411Nothingnoreaction Code412Avoidant Code413Acceptance Code414ReverseEmotionalRe Code421Hitting Code422Yelling Code423Stealing Code424Ignoressafetyins Code425AggressiveOther Code431Singing Code432Dancing Code433Askforhelp Code434DeterminedBehavior Code435Findinganalternati Code436Playingcontinueto Code437RestingTakingabr Code438Sharing Code439Expressingkindword {
	label variable `i' "Frequency of mentioning `i'
}

label hhid_cg_id_d "child ID"
save "qual_vocab_strategies", replace 
*all of these outcomes were involved in chained imputations






import excel situation_knowledge.xlsx, firstrow clear
**story one target word jealousy
gen story1_item1=Code117_s1
replace story1_item1=1 if Code00_s1==1
replace story1_item1=2 if Code121_s1==1
replace story1_item1=3 if Code117_s1==1
fre story1_item1
label variable story1_item1 "Jealousy target word 4-point ordinal scale"
label define target_ordinal 0 "never mentioned/described correctly" 1 "correctly mentioned when asked later" 2 "correctly described when asked" 3"correctly mentioned when asked"
label values story1_item1 target_ordinal

***story two target word caring
gen story2_item1=Code112_s2
replace story2_item1=1 if Code00_s2==1
replace story2_item1=2 if Code122_s2==1
replace story2_item1=3 if Code112_s2==1
fre story2_item1
label variable story2_item1 "Caring target word 4-point ordinal scale"
label values story2_item1 target_ordinal


***story three target word hope/determination
gen story3_item1=Code116_s3
replace story3_item1=1 if Code00_s3==1
replace story3_item1=2 if Code123_s3==1
replace story3_item1=3 if Code116_s3==1
fre story3_item1
label variable story3_item1 "Hope/determination target word 4-point ordinal scale"
label values story3_item1 target_ordinal

***story four target word  nervousness
gen story4_item1=Code115_s4
replace story4_item1=1 if Code00_s4==1
replace story4_item1=2 if Code124_s4==1
replace story4_item1=3 if Code115_s4==1
fre story4_item1
label variable story4_item1 "Nervousness target word 4-point ordinal scale"
label values story4_item1 target_ordinal


***story five target word loneliness
gen story5_item1=Code118_s5
replace story5_item1=1 if Code00_s5==1
replace story5_item1=2 if Code125_s5==1
replace story5_item1=3 if Code118_s5==1
fre story5_item1
label variable story5_item1 "Lonliness target word 4-point ordinal scale"
label values story5_item1 target_ordinal


***story six target word cared
gen story6_item1=Code112_s6
replace story6_item1=1 if Code00_s6==1
replace story6_item1=2 if Code122_s6==1
replace story6_item1=3 if Code112_s6==1
fre story6_item1
label variable story6_item1 "Cared target word 4-point ordinal scale"
label values story6_item1 target_ordinal


***story seven target word frustration
gen story7_item1=Code114_s7
replace story7_item1=1 if Code00_s7==1
replace story7_item1=2 if Code126_s7==1
replace story7_item1=3 if Code114_s7==1
fre story7_item1
label variable story7_item1 "Frustration target word 4-point ordinal scale"
label values story7_item1 target_ordinal



***story eight target word nervousness
gen story8_item1=Code115_s8
replace story8_item1=1 if Code00_s8==1
replace story8_item1=2 if Code124_s8==1
replace story8_item1=3 if Code115_s8==1
fre story8_item1
label variable story8_item1 "Nervousness target word 4-point ordinal scale"
label values story8_item1 target_ordinal


***story 9 target word hope
gen story9_item1=Code116_s9
replace story9_item1=1 if Code00_s9==1
replace story9_item1=2 if Code123_s9==1
replace story9_item1=3 if Code116_s9==1
fre story9_item1
label variable story9_item1 "Hope target word 4-point ordinal scale"
label values story9_item1 target_ordinal

***story10 target word jealousy
gen story10_item1=Code117_s10
replace story10_item1=1 if Code00_s10==1
replace story10_item1=2 if Code121_s10==1
replace story10_item1=3 if Code117_s10==1
fre story10_item1
label variable story10_item1 "Jealousy target word 4-point ordinal scale"
label values story10_item1 target_ordinal


**story11 target word loneliness
gen story11_item1=Code118_s11
replace story11_item1=1 if Code00_s11==1
replace story11_item1=2 if Code125_s11==1
replace story11_item1=3 if Code118_s11==1
fre story11_item1
label variable story11_item1 "Loneliness target word 4-point ordinal scale"
label values story11_item1 target_ordinal


*****valence
*story1 negative
gen story1_item1_valence=Code111_s1
replace story1_item1_valence=1 if Code113_s1==1
replace story1_item1_valence=1 if Code114_s1==1
replace story1_item1_valence=1 if Code115_s1==1
replace story1_item1_valence=1 if Code117_s1==1
replace story1_item1_valence=1 if Code118_s1==1
replace story1_item1_valence=1 if Code119_s1==1
replace story1_item1_valence=1 if Code1113_s1==1
fre story1_item1_valence
label variable story1_item1_valence "Valence for jealousy target word"
label define target_valence 0 "never mentioned or incorrectly mentioned valence" 1 "correct valence"
label values story1_item1_valence target_valence


*story 2 positive
gen story2_item_valence=Code112_s2
replace story2_item_valence=1 if Code116_s2==1
replace story2_item_valence=1 if Code1110_s2==1
replace story2_item_valence=1 if Code11110_s2==1
replace story2_item_valence=1 if Code1112_s2==1
fre story2_item_valence
label variable story2_item_valence "Valence for caring target word"
label values story2_item_valence target_valence


*story 3 negative 
gen story3_item1_valence=Code111_s3
replace story3_item1_valence=1 if Code113_s3==1
replace story3_item1_valence=1 if Code114_s3==1
replace story3_item1_valence=1 if Code115_s3==1
replace story3_item1_valence=1 if Code117_s3==1
replace story3_item1_valence=1 if Code118_s3==1
replace story3_item1_valence=1 if Code119_s3==1
replace story3_item1_valence=1 if Code1113_s3==1
fre story3_item1_valence
label variable story3_item1_valence "Valence for hope/determination target word"
label values story3_item1_valence target_valence



*story 4 5 6 7 9 10 11 negative 
foreach i in 4 5 6 7 9 10 11{
	gen story`i'_item1_valence=Code111_s`i'
replace story`i'_item1_valence=1 if Code113_s`i'==1
replace story`i'_item1_valence=1 if Code114_s`i'==1
replace story`i'_item1_valence=1 if Code115_s`i'==1
replace story`i'_item1_valence=1 if Code117_s`i'==1
replace story`i'_item1_valence=1 if Code118_s`i'==1
replace story`i'_item1_valence=1 if Code119_s`i'==1
replace story`i'_item1_valence=1 if Code1113_s`i'==1
fre story`i'_item1_valence


}

label variable story4_item1_valence "Valence for nervousness target word"
label values story4_item1_valence target_valence

label variable story5_item1_valence "Valence for lonliness target word"
label values story5_item1_valence target_valence

label variable story6_item1_valence "Valence for cared target word"
label values story6_item1_valence target_valence

label variable story7_item1_valence "Valence for frustration target word"
label values story7_item1_valence target_valence

label variable story9_item1_valence "Valence for hope target word"
label values story9_item1_valence target_valence

label variable story10_item1_valence "Valence for jealousy target word"
label values story10_item1_valence target_valence

label variable story11_item1_valence "Valence for loneliness target word"
label values story11_item1_valence target_valence

*story 8 positive 
gen story8_item_valence=Code112_s8
replace story8_item_valence=1 if Code116_s8==1
replace story8_item_valence=1 if Code1110_s8==1
replace story8_item_valence=1 if Code11110_s8==1
replace story8_item_valence=1 if Code1112_s8==1
fre story8_item_valence

label variable story8_item_valence "Valence for nervousness target word"
label values story8_item_valence target_valence

***average
egen jealousy_word=rowmean(story1_item1 story10_item1)
label variable jealousy_word "Average jealousy target word 4-point ordinal scale"

egen caring_word=rowmean(story2_item1 story6_item1)
label variable caring_word "Average caring target word 4-point ordinal scale"

egen hope_word=rowmean(story3_item1 story9_item1)
label variable hope_word "Average hope/determination target word 4-point ordinal scale"


egen nervous_word=rowmean(story4_item1 story8_item1)
label variable nervous_word "Average nervous target word 4-point ordinal scale"

egen lonely_word=rowmean(story5_item1 story11_item1)
label variable lonely_word "Average lonely target word 4-point ordinal scale"


egen story_item1_target=rowmean(story1_item1 story2_item1 story3_item1 story4_item1 story5_item1 story6_item1 story7_item1 story8_item1 story9_item1 story10_item1 story11_item1)
fre story_item1_target
label variable story_item1_target "average situation knowledge target word aggregate 4-point ordinal"

egen story_item1_valence=rowmean(story1_item1_valence story2_item_valence story3_item1_valence story4_item1_valence story5_item1_valence story6_item1_valence story7_item1_valence story9_item1_valence story10_item1_valence story11_item1_valence story8_item_valence)
fre story_item1_valence
label variable story_item1_valence "average situation knowledge target word valence"



///our original plan was to treat these outcomes as ordinal variables. But we later decided to split them into four variables: 1) correct word when asked; 2） correct description; 3) correct word mentioned later in tha task; 4) valence. That's why these ordinal variables were involved in multiple imputations. To avoid confusion, we deleted these ordinal variables in the provided dataset.
save "situation_knowledge", replace

use "situation_knowledge", clear
**story one &ten target word jealousy
egen jealousy_asked=rowmean(Code117_s1 Code117_s10)
label variable jealousy_asked "proportion of correctly mentioned jealousy when asked"
egen jealousy_desc=rowmean(Code121_s1 Code121_s10)
label variable jealousy_desc "proportion of correctly described jealousy"
egen jealousy_later=rowmean(Code00_s1 Code00_s10)
label variable jealousy_later "proportion of correctly mentioned jealousy later in the task (when not asked directly)"
egen jealousy_valence=rowmean(story1_item1_valence story10_item1_valence)
label variable jealousy_valence "average time jealousy valence was correctly mentioned "


***story two and 6 target word caring
egen caring_asked=rowmean(Code112_s2 Code112_s6)
label variable caring_asked "proportion of correctly mentioned caring when asked"
egen caring_desc=rowmean(Code122_s2 Code122_s6)
label variable caring_desc "proportion of correctly described caring"
egen caring_later=rowmean( Code00_s2 Code00_s6)
label variable caring_later "proportion of correctly mentioned caring later in the task (when not asked directly)"
egen caring_valence=rowmean(story2_item_valence story6_item1_valence)
label variable caring_valence "average time caring valence was correctly mentioned "



***story three and nine target word hope/determination
egen hope_asked=rowmean(Code116_s3 Code116_s9 )
label variable hope_asked "proportion of correctly mentioned hope/determination when asked"
egen hope_desc=rowmean(Code123_s3 Code123_s9)
label variable hope_desc "proportion of correctly described hope/determination"
egen hope_later=rowmean(Code00_s3 Code00_s9)
label variable hope_later "proportion of correctly mentioned hope/determination later in the task (when not asked directly)"
egen hope_valence=rowmean(story3_item1_valence story9_item1_valence)
label variable hope_valence "average time hope/determination valence was correctly mentioned "


***story four and eight target word  nervousness
egen nervous_asked=rowmean(Code115_s4 Code115_s8)
label variable nervous_asked "proportion of correctly mentioned nervous when asked"
egen nervous_desc=rowmean(Code124_s4 Code124_s8)
label variable nervous_desc "proportion of correctly described nervous"
egen nervous_later=rowmean(Code00_s4 Code00_s8)
label variable nervous_later "proportion of correctly mentioned nervous later in the task (when not asked directly)"
egen nervous_valence=rowmean(story4_item1_valence story8_item_valence)
label variable nervous_valence "average time nervous valence was correctly mentioned "


***story five and eleven target word loneliness
egen lonely_asked=rowmean(Code118_s5 Code118_s11)
label variable lonely_asked "proportion of correctly mentioned lonely when asked"
egen lonely_desc=rowmean(Code125_s5 Code125_s11)
label variable lonely_desc "proportion of correctly described lonely "
egen lonely_later=rowmean(Code00_s5 Code00_s11 )
label variable lonely_later "proportion of correctly mentioned lonely later in the task (when not asked directly)"
egen lonely_valence=rowmean(story5_item1_valence story11_item1_valence)
label variable lonely_valence "average time lonley valence was correctly mentioned "

***story seven target word frustration
egen frustration_asked=Code114_s7
label variable frustration_asked "proportion of correctly mentioned frustration when asked"
egen frustration_desc=Code126_s7
label variable frustration_desc "proportion of correctly described frustration"
egen frustration_later=Code00_s7
label variable frustration_later "proportion of correctly mentioned frustration later in the task (when not asked directly)"
rename story7_item1_valence frustration_valence

egen correct_mention_asked=rowmean(Code117_s1 Code117_s10 Code112_s2 Code112_s6 Code116_s3 Code116_s9 Code115_s4 Code115_s8 Code118_s5 Code118_s11 Code114_s7)
label variable correct_mention_asked "average time target word was correctly mentioned when asked"

egen correct_description=rowmean(Code121_s1 Code121_s10 Code122_s2 Code122_s6 Code123_s3 Code123_s9  Code124_s4 Code124_s8 Code125_s5 Code125_s11 Code126_s7)
label variable correct_description "average time target word was correctly described"


egen correct_mention_later=rowmean(Code00_s1 Code00_s10 Code00_s2 Code00_s6 Code00_s3 Code00_s9 Code00_s4 Code00_s8 Code00_s5 Code00_s11 Code00_s7)
label variable correct_mention_later "average time target word was correctly mentioned later not when asked"

///these variables were added after the main chain imputations. They are in table 2 outcome C and appendix F

save "situation_knowledge", replace




**# Quantitative child-directed measures #

import excel quant.xlsx, firstrow clear

foreach i in g1_q1a g1_q2a g1_q3a g1_q4a g1_q5a g1_q6a{
    gen quant_corr_`i'=.
	replace quant_corr_`i'=0 if `i'==2 /*incorrect*/
	replace quant_corr_`i'=0 if `i'==7777 /*don't know*/
	replace quant_corr_`i'=0 if `i'==0 /*no answer*/
	replace quant_corr_`i'=1 if `i'==1
	fre quant_corr_`i'
}
label var quant_corr_g1_q1a "expressive_happy"
label define expressive 0 "incorrect" 1 "correct" 
label values quant_corr_g1_q1a expressive

label var quant_corr_g1_q2a "expressive_sad"
label values quant_corr_g1_q2a expressive

label var quant_corr_g1_q3a "expressive_angry"
label values quant_corr_g1_q3a expressive

label var quant_corr_g1_q4a "expressive_frustrated"
label values quant_corr_g1_q4a expressive

label var quant_corr_g1_q5a "expressive_sad"
label values quant_corr_g1_q5a expressive

label var quant_corr_g1_q6a "expressive_scared"
label values quant_corr_g1_q6a expressive




egen quant_game1_mean=rowmean(quant_corr_g1_q1a quant_corr_g1_q2a quant_corr_g1_q3a quant_corr_g1_q4a quant_corr_g1_q5a quant_corr_g1_q6a)
label var quant_game1_mean "proportion of correct expressive emotion recognition skills "  


***GAME 2
*STORY 1 HAPPY OPTION3 
gen quant_corr_game2_q1=.
replace  quant_corr_game2_q1=1 if g2_q1==3
replace  quant_corr_game2_q1=0 if g2_q1==0 | g2_q1==1 |g2_q1==2 |g2_q1==4|g2_q1==7777
fre  quant_corr_game2_q1
label var quant_corr_game2_q1 "receptive_happy"
label define receptive 0 "incorrect" 1 "correct" 
label values quant_corr_game2_q1 receptive


*STORY 2 frustrated option 3
gen  quant_corr_game2_q2=.
replace  quant_corr_game2_q2=1 if g2_q2==3
replace  quant_corr_game2_q2=0 if g2_q2==0 | g2_q2==1 |g2_q2==2 |g2_q2==4|g2_q2==7777
fre  quant_corr_game2_q2
label var quant_corr_game2_q2 "receptive_frustrated"
label values quant_corr_game2_q2 receptive

*STORY3 angry option 1
gen  quant_corr_game2_q3=.
replace  quant_corr_game2_q3=1 if g2_q3==1
replace  quant_corr_game2_q3=0 if g2_q3==0 | g2_q3==2 | g2_q3==3 | g2_q3==4 | g2_q3==7777
fre  quant_corr_game2_q3
label var quant_corr_game2_q3 "receptive_angry"
label values quant_corr_game2_q3 receptive

*STORY 4 scared/afriad option 2
gen  quant_corr_game2_q4=.
replace  quant_corr_game2_q4=1 if g2_q4==2
replace  quant_corr_game2_q4=0 if g2_q4==0 |g2_q4==1|g2_q4==3|g2_q4==4|g2_q4==7777
fre  quant_corr_game2_q4
label var quant_corr_game2_q4 "receptive_scared"
label values quant_corr_game2_q4 receptive

*STORY 5 sad option 2
gen  quant_corr_game2_q5=.
replace  quant_corr_game2_q5=1 if g2_q5==2
replace  quant_corr_game2_q5=0 if g2_q5==0 |g2_q5==1|g2_q5==3|g2_q5==4|g2_q5==7777
fre  quant_corr_game2_q5
label var quant_corr_game2_q5 "receptive_sad"
label values quant_corr_game2_q5 receptive
egen game2_mean=rowmean( quant_corr_game2_q1  quant_corr_game2_q2  quant_corr_game2_q3  quant_corr_game2_q4  quant_corr_game2_q5)
label var  quant_game2_mean "proportion of correct receptive emotion recognition skills" // this is the average receptive recognition skill seen in outcome group C in table 2. Appendix F shows the ITT effects on identifying different emotions.



***recode character recognition 
foreach i in g7_1a g7_2a g7_3a g7_4a g7_5a g7_6a g7_7a{
    gen corr_`i'=.
	replace corr_`i'=1 if `i'==1
	replace corr_`i'=0 if `i'==2 /*incorrect*/
	replace corr_`i'=0 if `i'==7777 /*don't know*/
	replace corr_`i'=0 if `i'==0 /*no answer*/
	fre corr_`i'
}
egen quant_recognise_game7_mean=rowmean(corr_g7_1a corr_g7_2a corr_g7_3a corr_g7_4a corr_g7_5a corr_g7_6a corr_g7_7a)
label var quant_recognise_game7_mean "proportion of correctly recognising characters in game 7"
fre quant_recognise_game7_mean // this is ability to recognise AS character as in outcome group A in table 1. 
***name Ahlan Simsim characters correctly
*game 1 is Basma so option 1
gen corr_g7_1b=.
replace corr_g7_1b=1 if g7_1b=="1"
replace corr_g7_1b=0 if g7_1b=="0" |g7_1b=="2" |g7_1b=="3" |g7_1b=="4" |g7_1b=="5" |g7_1b=="6" |g7_1b=="7" |g7_1b=="7777"
fre corr_g7_1b
*game 2 is Jad so option 2
gen corr_g7_2b=.
replace corr_g7_2b=1 if g7_2b=="2"
replace corr_g7_2b=0 if g7_2b=="0" |g7_2b=="1" |g7_2b=="3" |g7_2b=="4" |g7_2b=="5" |g7_2b=="6" |g7_2b=="7" |g7_2b=="7777"
fre corr_g7_2b
*game 3 is Elmo so option 6
gen corr_g7_3b=.
replace corr_g7_3b=1 if g7_3b=="6"
replace corr_g7_3b=0 if g7_3b=="0" |g7_3b=="1"|g7_3b=="2" |g7_3b=="3" |g7_3b=="4" |g7_3b=="5" |g7_3b=="7" |g7_3b=="7777"
fre corr_g7_3b
*game 4 is Abu'l Fihem so option 4
gen corr_g7_4b=.
replace corr_g7_4b=1 if g7_4b=="4"
replace corr_g7_4b=0 if g7_4b=="0" |g7_4b=="1"|g7_4b=="2" |g7_4b=="3" |g7_4b=="5" |g7_4b=="6" |g7_4b=="7" |g7_4b=="7777"
fre corr_g7_4b
*game 5 is Dabke Dancers so option 3
gen corr_g7_5b=.
replace corr_g7_5b=1 if g7_5b=="3"
replace corr_g7_5b=0 if g7_5b=="0" |g7_5b=="1"|g7_5b=="2" |g7_5b=="4" |g7_5b=="5" |g7_5b=="6" |g7_5b=="7" |g7_5b=="7777"
fre corr_g7_5b
*game 6 is Ma'zooza so option 7
gen corr_g7_6b=.
replace corr_g7_6b=1 if g7_6b=="7"
replace corr_g7_6b=0 if g7_6b=="0" |g7_6b=="1"|g7_6b=="2" |g7_6b=="3" |g7_6b=="4" |g7_6b=="5" |g7_6b=="6" |g7_6b=="7777"
fre corr_g7_6b
*game 7 is Gargur so option 5
gen corr_g7_7b=.
replace corr_g7_7b=1 if g7_7b=="5"
replace corr_g7_7b=0 if g7_7b=="0" |g7_7b=="1"|g7_7b=="2" |g7_7b=="3" |g7_4b=="4" |g7_7b=="6" |g7_7b=="7" |g7_7b=="7777"
fre corr_g7_7b
egen quant_name_game7_mean=rowmean(corr_g7_1b corr_g7_2b corr_g7_3b corr_g7_4b corr_g7_5b corr_g7_6b corr_g7_7b)
label var quant_name_game7_mean "propotion of correctly naming AScharacters"
fre quant_name_game7_mean // this is ability to name  AS character as in outcome group A in table 1. 

***where children knew Ahlan Simsim characters from
gen basma_origin=.
replace basma_origin=0 if g7_1c=="0" | g7_1c=="7777" /*don't know*/
replace basma_origin=1 if g7_1c=="1" /*AS*/
replace basma_origin=2 if g7_1c=="2" /*YT*/
replace basma_origin=3 if g7_1c=="3" /*other*/
fre basma_origin
label var basma_origin "learn basma from where"
label define basma_origin2 0 "don't know" 1 "Ahlam Simsim" 2 "TV/YouTube"  3 "other"
label value basma_origin basma_origin2

gen jad_origin=.
replace jad_origin=0 if g7_2c=="0" | g7_2c=="7777"
replace jad_origin=1 if g7_2c=="1"
replace jad_origin=2 if g7_2c=="2"
replace jad_origin=3 if g7_2c=="3"
fre jad_origin
label var jad_origin "learn jad from where "
label define jad_origin2 0 "don't know" 1 "Ahlam Simsim" 2 "TV/YouTube"  3 "other"
label value jad_origin basma_origin2

gen allcharacter_origin=.
replace allcharacter_origin=0 if g7_all=="0" | g7_all=="7777"
replace allcharacter_origin=1 if g7_all=="1"
replace allcharacter_origin=2 if g7_all=="2"
replace allcharacter_origin=3 if g7_all=="3"
fre allcharacter_origin
label var allcharacter_origin "learn all characters from where"
label define allcharacter_origin2 0 "don't know" 1 "Ahlam Simsim" 2 "TV/YouTube"  3 "other"
label value allcharacter_origin allcharacter_origin2


***characater liking 
foreach i in  g7_1d g7_2d g7_3d g7_4d g7_5d g7_6d g7_7d{
   gen corr_`i'=.
   replace corr_`i'=1 if `i'=="1"
   replace corr_`i'=0 if `i'=="0" | `i'=="2" | `i'=="7777"
   fre corr_`i'
}
egen quant_likecharacter_mean=rowmean(corr_g7_1d corr_g7_2d corr_g7_3d corr_g7_4d corr_g7_5d corr_g7_6d corr_g7_7d)
label var quant_likecharacter_mean "proportion of liking the AS characters" // this is whether children like AS characters as in outcome group A in table 1. 

foreach i in g1_q1a g1_q2a g1_q3a g1_q4a g1_q5a g1_q6a corr_game2_q1 corr_game2_q2 corr_game2_q3 corr_game2_q4 corr_game2_q5 game1_mean game2_mean name_game7_mean likecharacter_mean basma_origin jad_origin allcharacter_origin  {
	rename `i' quant_`i' /// this is to identify them as in quantitative child-direct assessments 
}


**recode AS_quant_basma_origin, AS_quant_jad_origin and AS_all_char into binary variables so that value=1 they learnt it from watching AS; value=0 otherwise
gen AS_quant_basma_origin=.
replace AS_quant_basma_origin=1 if quant_basma_origin==1
replace AS_quant_basma_origin0 if quant_basma_origin==0| quant_basma_origin==2 | quant_basma_origin==3
fre AS_quant_basma_origin // this is whether children identifed Basma from watching AS as in outcome group A in table 1. 
label var AS_quant_basma_origin "knew Basma from AS"
label define origin 0 "don't know/elsewhere" 1 "from Ahlam Simsim"
label values AS_quant_basma_origin origin


fre quant_jad_origin
gen AS_quant_jad_origin=.
replace AS_quant_jad_origin=1 if quant_jad_origin==1
replace AS_quant_jad_origin=0 if quant_jad_origin==0| quant_jad_origin==2 | quant_jad_origin==3
fre AS_quant_jad_origin // this is whether children identifed Jad from watching AS as in outcome group A in table 1. 
label var AS_quant_jad_origin "knew Jad from AS"
label values AS_quant_jad_origin origin

fre quant_allcharacter_origin
gen AS_cha_or=.
replace AS_cha_or=1 if quant_allcharacter_origin==1
replace AS_cha_or=0 if quant_allcharacter_origin==0 | quant_allcharacter_origin==2 |quant_allcharacter_origin==3
fre AS_cha_or 
label var AS_cha_or "knew all characters from AS"
label values AS_cha_or origin

save "quant", replace


**# Baseline caregiver-report survey #

import excel base_cg.xlsx, firstrow clear
*Ages & Stages Questionnaires (ASQ) which is available in Arabic 
*https://agesandstages.com/products-pricing/asq3/#silk-tabs-0-2
*we conducted EFA and CFA in MPLUS, which indicates convergence in five ASQ sub-scales. Constraining the factor loadings to be the same suggests satisfactory model fit. For the ease of interpretation, we averaged items in each subscale. 
foreach x in comm1_60 comm2_60 comm3_60 comm4_60 comm5_60 comm6_60 gmot1_60 gmot2_60 gmot3_60 gmot4_60 gmot5_60 gmot6_60 fmot1_60 fmot2_60 fmot3_60 fmot4_60 fmot5_60 fmot6_60 pslv1_60 pslv2_60 pslv3_60 pslv4_60 pslv5_60 pslv6_60 psoc1_60 psoc2_60 psoc3_60 psoc4_60 psoc5_60 psoc6_60{
 replace `x' = . if `x'==-9999
 replace `x' = . if `x'==-8888
  }
egen COMM = rowmean(comm1_60 comm2_60 comm3_60 comm4_60 comm5_60 comm6_60)
egen GMOT = rowmean (gmot1_60 gmot2_60 gmot3_60 gmot4_60 gmot5_60 gmot6_60)
egen FMOT = rowmean (fmot1_60 fmot2_60 fmot3_60 fmot4_60 fmot5_60 fmot6_60)
egen PSOC = rowmean (psoc1_60 psoc2_60 psoc3_60 psoc4_60 psoc5_60 psoc6_60)
egen PSLV = rowmean(pslv1_60 pslv2_60 pslv3_60 pslv4_60 pslv5_60 pslv6_60)

foreach i in COMM GMOT FMOT PSLV PSOC{
	rename `i' base_`i'
}
label var base_COMM "mean baseline ASQ communication skills"
label var base_GMOT "mean baseline ASQ gross motor skills"
label var base_FMOT "mean baseline ASQ fine motor skills"
label var base_PSOC "mean baseline ASQ personal-social skills"
label var base_PSLV "mean baseline ASQ problem solving skills"

***Brief Problem Monitor (BPM)
*openly accessible by Achenbach et al (2011): https://documents.acer.org/ASEBA_Brief_Problem_Monitor_Manual.pdf 

forvalues i=1/19{
gen n_bpm_`i'=.
replace n_bpm_`i'=0 if bpm_`i'==0
replace n_bpm_`i'=1 if bpm_`i'==1
replace n_bpm_`i'=2 if bpm_`i'==2
	label define  n_bpm_`i' 0 "never" 1 "sometimes" 2 "all the time"
	label values  n_bpm_`i'  n_bpm_`i'
	drop bpm_`i'
	rename n_bpm_`i' bpm_`i'
	}
*we conducted EFA and CFA in MPLUS, which indicates convergence in three BPM sub-scales. Constraining the factor loadings to be the same suggests satisfactory model fit. For the ease of interpretation, we averaged items in each subscale. 
egen base_bpm_attention= rmean (bpm_1 bpm_3 bpm_4 bpm_5 bpm_10 bpm_14)
label var base_bpm_attention "mean baseline BPM attentional problems"

egen base_bpm_internal= rmean(bpm_2 bpm_6 bpm_7 bpm_8 bpm_15 bpm_16 bpm_17)
label var base_bpm_internal "mean baseline BPM internalising problems"

egen base_bpm_external= rmean(bpm_9 bpm_11 bpm_12 bpm_13 bpm_18 bpm_19)
label var base_bpm_external "mean baseline BPM externalising problems"




**media as recode
gen media_AS=media_5_AS
replace media_AS=0 if media_5_AS==.
replace media_AS=1 if media_9_AS==1
replace media_AS=2 if media_8_AS==1
replace media_AS=3 if media_7_AS==1
fre media_AS
label var media_AS "baseline frequency of watching Ahlan Simsim at home"
label define media_AS_1 0 "don't want AS at all" 1 "watch AS a few times a month" 2 "watch AS a few times a week" 3 "watch AS daily"
label values media_AS media_AS_1

**access to social support if children need help
encode ss_chi_h0, gen (ss_children)
fre ss_children
gen ss_children2=.
replace ss_children2=0 if ss_children==2
replace ss_children2=1 if ss_children==1
drop ss_children
rename ss_children2 ss_children
label var ss_children "social support is available if your child ever needed help in the last 3 months"
label define ss 0 "no" 1 "yes"
label values ss_children ss


**access to social support if house needs resources
encode ss_hh_h0, gen (ss_house)
fre ss_house
gen ss_house2=.
replace ss_house2=0 if ss_house==2
replace ss_house2=1 if ss_house==1
drop ss_house
rename ss_house2 ss_house
label var ss_house "social support is available if your family ever needed help in the last 3 months "
label values ss_house ss



**access to social support for personal urgencies
encode ss_per_h0, gen (ss_personal)
fre ss_personal
gen ss_personal2=.
replace ss_personal2=0 if ss_personal==2
replace ss_personal2=1 if ss_personal==1
drop ss_personal
rename ss_personal2 ss_personal
label var ss_personal "social support is available if you personally ever needed help in the last 3 months"
label values ss_personal ss


**child stimulation scale (mics)
foreach i in mics_1 mics_2 mics_3 mics_4 mics_5 mics_6 mics_7 mics_8{
	encode `i', gen (`i'_n)
	gen `i'_m=.
	replace `i'_m=0 if `i'_n==2
	replace `i'_m=1 if `i'_n==4
	drop `i'_n
}
	egen mics_mean=rowmean(mics_1_m mics_2_m mics_3_m mics_4_m mics_5_m mics_6_m mics_7_m mics_8_m)
label var mics_mean "mean child stimulation activties/resources at home"




***nationality of the child
gen natsyr=.
replace natsyr=1 if n_p_National==4
replace natsyr=1 if n_p_National==5
replace natsyr=0 if n_p_National<4 & n_p_National!=.
/// if children's nationality is Syrian, it's value=0; otherwise value=1
label var natsyr "children's nationality"
label define natsyr 0 "Jordanian" 1 "Syrian"
label values natsyr natsyr

**parenting stress scale
*we conducted EFA and CFA in MPLUS, which indicates convergence in one scale. Constraining the factor loadings to be the same suggests satisfactory model fit. For the ease of interpretation, we used average score. 
foreach i in pss_1 pss_2 pss_3 pss_4 pss_5 pss_6 pss_7 pss_8 pss_9{
	encode `i', gen (`i'_n)
	gen `i'_m=.
	replace `i'_m=0 if `i'_n==2 /*never*/
	replace `i'_m=1 if `i'_n==5 /*seldom*/
	replace `i'_m=2 if `i'_n==3 /*often*/
	replace `i'_m=3 if `i'_n==1 /*always*/
}
egen pss_mean=rowmean(pss_1_m pss_2_m pss_3_m pss_4_m pss_5_m pss_6_m pss_7_m pss_8_m pss_9_m)
label var pss_mean "average parenting stress scale"




***caregiver's highest level of education
///there were some revisions to the kobo choices. Values were recoded as below
encode b_educ, gen (cg_educ )
recode cg_educ (4 13 =.) (2 5 8 = 1) (1 6 9 10 11 = 5) (12 = 2) (7 = 3) (3 = 4), gen(cg_educ_vf) 
label var cg_educ_vf "caregiver's highest education certificate"
label define edu 1 "basic education and below" 2"preparatory education" 3"high school degree" 4"diploma" 5"bachelor's degree and above'"
label values cg_educ_vf edu

*caregiver's general health
encode h_o_gen, gen (cg_general_health)
fre cg_general_health
gen cg_general_health2=.
replace cg_general_health2=1 if cg_general_health==6
replace cg_general_health2=2 if cg_general_health==4
replace cg_general_health2=3 if cg_general_health==1
replace cg_general_health2=4 if cg_general_health==2
label var cg_general_health2 "caregiver's general health recode"
label define cg_general_health22 1 "very poor" 2 "poor" 3 "fair" 4 "good"
label value cg_general_health2 cg_general_health22
drop cg_general_health
rename cg_general_health2 cg_general_health

label var hh_adnum "number of adults in household"
label var hh_cnum "number of children in household"


save "baseline_cg", replace

*Perceived Refugee Environment Index (PREI)
foreach i in prei_1 prei_2 prei_3 prei_4 prei_5 prei_6 prei_7 prei_8 prei_9 prei_10 prei_11 prei_15 prei_19{
	encode `i', gen (n_`i')
	gen m_`i'=.
	replace m_`i'=0 if n_`i'==2 /*never*/
	replace m_`i'=1 if n_`i'==5 /*seldom*/
	replace m_`i'=2 if n_`i'==3 /*often*/
	replace m_`i'=3 if n_`i'==1 /*always*/
	tab n_`i' m_`i',m
	
}
alpha m_prei_1  m_prei_3 m_prei_4 m_prei_5 m_prei_6
     m_prei_7 m_prei_8 m_prei_9 m_prei_10 m_prei_11 m_prei_15 m_prei_19, item ///*we later dropped prei_2 because even after reverse coding, it worked in a negative direction than hypothesised to the rest of the items.
/*we ran the following codes in MPLUS*
Variable:
  Names are 
     hhid_cg_id_d m_prei_1  m_prei_3 m_prei_4 m_prei_5 m_prei_6
     m_prei_7 m_prei_8 m_prei_9 m_prei_10 m_prei_11 m_prei_15 m_prei_19;
  Missing are all (-9999) ; 
  IDVARIABLE is hhid_cg_id_d;

Usevariables are 
m_prei_1  m_prei_3 m_prei_4 m_prei_5 m_prei_6
     m_prei_7 m_prei_8 m_prei_9 m_prei_10 m_prei_11 m_prei_15 m_prei_19;
Model: 
PREI by m_prei_1  m_prei_3 m_prei_4 m_prei_5 m_prei_6
     m_prei_7 m_prei_8 m_prei_9 
     m_prei_10 m_prei_11 m_prei_15 m_prei_19;
m_prei_6 WITH m_prei_7;
M_PREI_5 WITH M_PREI_4  ;
M_PREI_10 WITH M_PREI_11;

OUTPUT: RESIDUAL; SAMP;STDYX;MOD;
 SAVEDATA: SAVE=FSCORES;
 file is preifascores.txt;
*/
*import to  preifascores.xlsx before importing to stata
label var Prei_fscore "Perceived Refugee Environment Index factor score" 
import excel  preifascores.xlsx, firstrow clear
save "preifascores", replace


**# Endline caregiver-report survey #
import excel end_cg.xlsx, firstrow clear

*endline ASQ
foreach x in  comm1_60 comm2_60 comm3_60 comm4_60 comm5_60 comm6_60 gmot1_60 gmot2_60 ///
 gmot3_60 gmot4_60 gmot5_60 gmot6_60 fmot1_60 fmot2_60 fmot3_60 fmot4_60 fmot5_60 ///
 fmot6_60 pslv1_60 pslv2_60 pslv3_60 pslv4_60 pslv5_60 pslv6_60 psoc1_60 psoc2_60 ///
 psoc3_60 psoc4_60 psoc5_60 psoc6_60 {
 replace `x' = . if `x'==-9999
 replace `x' = . if `x'==-8888
  }
 egen end_COMM = rowmean(comm1_60 comm2_60 comm3_60 comm4_60 comm5_60 comm6_60)
 egen end_GMOT = rowmean (gmot1_60 gmot2_60 ///
 gmot3_60 gmot4_60 gmot5_60 gmot6_60)
 egen end_FMOT = rowmean (fmot1_60 fmot2_60 fmot3_60 fmot4_60 fmot5_60 ///
 fmot6_60)
 egen end_PSLV = rowmean(pslv1_60 pslv2_60 pslv3_60 pslv4_60 pslv5_60 pslv6_60)
 egen end_PSOC = rowmean (psoc1_60 psoc2_60 ///
 psoc3_60 psoc4_60 psoc5_60 psoc6_60 )
 
 
label var end_COMM "mean endline ASQ communication skills"
label var end_GMOT "mean endline ASQ gross motor skills"
label var end_FMOT "mean endline ASQ fine motor skills"
label var end_PSOC "mean endline ASQ personal-social skills"
label var end_PSLV "mean endline ASQ problem solving skills"

 
 
*endline BPM
forvalues i=1/19{
gen n_bpm_`i'=.
replace n_bpm_`i'=0 if bpm_`i'==0
replace n_bpm_`i'=1 if bpm_`i'==1
replace n_bpm_`i'=2 if bpm_`i'==2
	label define  n_bpm_`i' 0 "never" 1 "sometimes" 2 "all the time"
	label values  n_bpm_`i'  n_bpm_`i'
	drop bpm_`i'
	rename n_bpm_`i' bpm_`i'
	}

egen end_bpm_attention= rmean (bpm_1 bpm_3 bpm_4 bpm_5 bpm_10 bpm_14)
egen end_bpm_internal= rmean(bpm_2 bpm_6 bpm_7 bpm_8 bpm_15 bpm_16 bpm_17)
egen end_bpm_external= rmean(bpm_9 bpm_11 bpm_12 bpm_13 bpm_18 bpm_19)

label var end_bpm_attention "mean endline BPM attentional problems"
label var end_bpm_internal "mean endline BPM internalising problems"
label var end_bpm_external "mean endline BPM externalising problems"




*frequency of using key words/phrases from AS at home outcome group B in table 1

foreach i in emotion_4 emotion_7 emotion_6 emotion_8 emotion_9 emotion_5 emotion_1 emotion_3 emotion_2{
	replace `i'=. if `i'<0
		rename `i' end_`i'

}

*watching AS at home
gen end_media_AS=media_5_AS
replace end_media_AS=0 if media_5_AS==0
replace end_media_AS=1 if media_9_AS==1
replace end_media_AS=2 if media_8_AS==1
replace end_media_AS=3 if media_7_AS==1
fre end_media_AS
label var end_media_AS "endline frequency of watching Ahlan Simsim"
label define end_media_AS_1 0 "don't want AS at all" 1 "watch AS a few times a month" 2 "watch AS a few times a week" 3 "watch AS daily"
label values end_media_AS end_media_AS_1


*children's health
gen childhealth=fc_heal
replace childhealth=. if fc_heal<0
label var childhealth "child's general health'"

*other covariates: 
label var b_age "caregiver's age in years'"

label var childgender "child's gender'"
label var cg_gender "caregiver's gender'"
label var childage "child's age in months'"


save "endline_cg", replace




**# teacher-report survey #
import excel teacher.xlsx, firstrow clear


*recode years of teaching 
gen t_dm_prev_experience2 = date(prev_experience, "DMY")
format t_dm_prev_experience2 %td
tab t_dm_prev_experience2
gen t_dm_prev_experience3=year(t_dm_prev_experience2)
tab t_dm_prev_experience3
gen t_dm_prev_experience4=month(t_dm_prev_experience2)
gen t_dm_yrs_teach=(2022-t_dm_prev_experience3)+(t_dm_prev_experience4/12)
tab t_dm_yrs_teach, m
label var t_dm_yrs_teach "teacher's years of teaching experience"

gen t_dm_teacher_educ = teacher_educ
replace t_dm_teacher_edu=. if teacher_educ>8 ///these options were vaguely worded, thus we decide to treat them as missing
label var t_dm_teacher_edu "teacher's highest education qualification"

///we also generated tcc_num_stdnts, which is a variable that records the average number of students the teacher has been teaching in their classrooms across the academic year. This variable was collected through a different survey (not provided here due to other private information)
label var tcc_num_stdnts "number of students in the class"


save "teacher", replace

*******************************************
*****************
**# information regarding the treatment/control schools (tx) and the school governorate  (n_gov) were obtained from school information #
label var n_gov "school governorate"
**we further extracted three governorates and governorate*treatment/control school status for moderation analyses by governorate 
gen Al_Balqa=. 
replace Al_Balqa=1 if n_gov==1
replace Al_Balqa=0 if n_gov!=1
label var Al_Balqa "Based in Al-Balqa"
label define gov 0 "no" 1 "yes"
label values Al_Balqa gov

gen Al_Karak=. 
replace Al_Karak=1 if n_gov==2
replace Al_Karak=0 if n_gov!=2
label var Al_Karak "Based in Al-Karak"
label values Al_Karak gov

gen tx_Al_Balqa=Al_Balqa*tx
label var tx_Al_Balqa "interaction between treatment/control scools and Based in Al-Balqa"
label define tx_gov 0 "otherwise" 1"treatment school and in this governorate"
label values tx_Al_Balqa tx_gov

gen tx_Al_Karak=Al_Karak*tx
label var tx_Al_Karak "interaction between treatment/control scools and Based in Al-Karak"
label values tx_Al_Karak tx_gov

**# Merge #
use "qual_vocab_strategies"
merge 1:1 hhid_cg_id_d using "situation_knowledge"
drop _merge
merge 1:1 hhid_cg_id_d using "quant"
drop _merge
merge 1:1 hhid_cg_id_d using "baseline_cg"
drop _merge
merge 1:1 hhid_cg_id_d using "preifascores"
drop _merge
merge 1:1 hhid_cg_id_d using "endline_cg"
drop _merge
merge 1:1 hhid_cg_id_d using "teacher"
save "ASdata"

**# Imputation #
set maxvar 100000
use "ASdata"
mdesc _all
misstable sum _all
mi set wide
mi register imputed childgender b_age pss_mean cg_educ_vf t_dm_teacher_educ mics_mean Prei_fscore hh_num t_dm_yrs_teach tcc_num_stdnts  base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external end_COMM end_GMOT end_FMOT end_PSLV end_PSOC end_bpm_attention end_bpm_internal end_bpm_external end_emotion_1 end_emotion_2 end_emotion_3 end_emotion_4 end_emotion_5  end_emotion_6 end_emotion_7 end_emotion_8 end_emotion_9 quant_game1_mean quant_game2_mean story_item1_target story_item1_valence quant_recognise_game7_mean quant_name_game7_mean quant_likecharacter_mean AS_quant_basma_origin AS_quant_jad_origin  AS_cha_or Code111Anger Code112Caring Code113Fear Code114Frustration Code115Nervousness Code116HopeDetermination Code117Jealousy Code118Loneliness Code119Sadness Code1110Happiness Code1111Otheremotion Code1112Positiveemotionle Code1113Negativeemotionle Code311Nothingnoreaction Code312Avoidant Code313Acceptance Code321Hitting Code322Yelling Code323Stealing Code324Ignoressafetyins Code325AggressiveOther Code331Singing Code332Dancing Code333Askforhelp Code334DeterminedBehavior Code335Findinganalternati Code336Playingcontinueto Code337RestingTakingabr Code338Sharing Code339Expressingkindword Code34Same Code411Nothingnoreaction Code412Avoidant Code413Acceptance Code414ReverseEmotionalRe Code421Hitting Code422Yelling Code423Stealing Code424Ignoressafetyins Code425AggressiveOther Code431Singing Code432Dancing Code433Askforhelp Code434DeterminedBehavior Code435Findinganalternati Code436Playingcontinueto Code437RestingTakingabr Code438Sharing Code439Expressingkindword  natsyr story1_item1 story2_item1 story3_item1 story4_item1 story5_item1 story6_item1 story7_item1 story8_item1 story9_item1 story10_item1 story11_item1 story1_item1_valence story2_item_valence story3_item1_valence story4_item1_valence story5_item1_valence story6_item1_valence story7_item1_valence story9_item1_valence story10_item1_valence story11_item1_valence story8_item_valence 
//*we decided to extract extra variables including situation knowledge (when asked, described, mentioned later, valence) by emotions after this series of chained imputations.

mi impute chained (logit) childgender (logit, omit (i.t_dm_teacher_educ Code421Hitting Code422Yelling  Code425AggressiveOther Code432Dancing)) natsyr  (pmm, knn(10)) b_age pss_mean (ologit) cg_educ_vf t_dm_teacher_educ (regress) mics_mean Prei_fscore hh_num t_dm_yrs_teach tcc_num_stdnts (regress, omit(i.tx end_media_AS end_COMM end_GMOT end_FMOT end_PSLV end_PSOC end_bpm_attention end_bpm_internal end_bpm_external)) base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external (regress, omit (i.tx base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external)) end_COMM end_GMOT end_FMOT end_PSLV end_PSOC end_bpm_attention end_bpm_internal end_bpm_external end_emotion_1 end_emotion_2 end_emotion_3 end_emotion_4 end_emotion_5 end_emotion_6 end_emotion_7 end_emotion_8 end_emotion_9  (regress, omit (i.tx base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external)) quant_game1_mean quant_game2_mean story_item1_target story_item1_valence    (regress, omit (i.tx base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external)) quant_recognise_game7_mean quant_name_game7_mean quant_likecharacter_mean (logit, omit (i.tx base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external)) AS_quant_basma_origin AS_quant_jad_origin AS_cha_or (ologit, omit (i.tx base_COMM base_GMOT base_FMOT base_PSLV base_PSOC base_bpm_attention base_bpm_internal base_bpm_external)) Code111Anger Code112Caring Code113Fear Code114Frustration Code115Nervousness Code116HopeDetermination Code117Jealousy Code118Loneliness Code119Sadness Code1110Happiness Code1111Otheremotion Code1112Positiveemotionle Code1113Negativeemotionle Code311Nothingnoreaction Code312Avoidant Code313Acceptance Code321Hitting Code322Yelling Code323Stealing Code324Ignoressafetyins Code325AggressiveOther Code331Singing Code332Dancing Code333Askforhelp Code334DeterminedBehavior Code335Findinganalternati Code336Playingcontinueto Code337RestingTakingabr Code338Sharing Code339Expressingkindword Code34Same Code411Nothingnoreaction Code412Avoidant Code413Acceptance Code414ReverseEmotionalRe Code421Hitting Code422Yelling Code423Stealing Code424Ignoressafetyins Code425AggressiveOther Code431Singing Code432Dancing Code433Askforhelp Code434DeterminedBehavior Code435Findinganalternati Code436Playingcontinueto Code437RestingTakingabr Code438Sharing Code439Expressingkindword story1_item1 story2_item1 story3_item1 story4_item1 story5_item1 story6_item1 story7_item1 story8_item1 story9_item1 story10_item1 story11_item1 story1_item1_valence story2_item_valence story3_item1_valence story4_item1_valence story5_item1_valence story6_item1_valence story7_item1_valence story9_item1_valence story10_item1_valence story11_item1_valence story8_item_valence  =i.tx end_media_AS, add(100) rseed (12345) noisily


save "ASdata_imputed", replace


**# Avoid re-identifying cases #
***in this openly accessible dataset, we deleted children's id (hhid_cg_id_d), children's nationality information (natsyr) and their age (childage) because the majority of Syrian children were disproportinately from Irbid (see table below), leaving Syrian children in Al-Balqa and Al-Karak at risks of re-identification, in combination with age in months information.
/*
children's |
nationalit |        school governorate
         y |  Al-Balqa   Al-Karak      Irbid |     Total
-----------+---------------------------------+----------
 Jordanian |     1,169        547      2,150 |     3,866 
    Syrian |        11          3         92 |       106 
-----------+---------------------------------+----------
     Total |     1,180        550      2,242 |     3,972 

*/

drop natsyr childage hhid_cg_id_d
**however, in our main analyses do file, we kept childage and natsyr for your information.


